<?php
require '/dbObject/UserPc.php';

class Buscar_UserPc{
	
	private $userPc;

	public function __construct($id_busqueda, $tipo_de_dato){
		//mysqli_connect(host,username,password,dbname);
		$con=mysqli_connect("localhost","root","","base_datos");
		// Check connection
		if (mysqli_connect_errno()) {
			echo "Failed to connect to MySQL: " . mysqli_connect_error();
		}else{
			$this->buscar($con, $id_busqueda, $tipo_de_dato);
		}
	}
	
	
	private function buscar($con, $id_busqueda, $tipo_de_dato){
		$result = mysqli_query($con,"SELECT * FROM user_pc WHERE ".$tipo_de_dato."=".$id_busqueda);		//ordenar resultado:
		$row = mysqli_fetch_array($result);
		$nro_userPc=$row['nro_userPc'];
		if($nro_userPc=$id_busqueda){
			$nombre_userPc=$row['nombre'];
			$apellido_userPc=$row['apellido'];
			$dni_userPc=$row['dni'];
			$mail_userPc=$row['mail'];
			$password=$row['$password'];;
			$userPc= new userPc($nro_userPc, $nombre_userPc, $apellido_userPc, $dni_userPc, $mail_userPc, $password);
			$this->userPc= $userPc;
		}
	}
	
	public function get_userPc_encontrado(){
		return $this->userPc;
	}
}
?>
